use std::collections::HashSet;

/// Counts the number of unique elements
///
/// # Parameters
/// - `input_str` - A comma-separated string of elements
///
/// # Returns
/// Returns the count of unique elements
pub fn new_count_distinct(input_str: &str) -> usize {
    // Use a HashSet to store unique elements
    let mut unique_elements = HashSet::new();
    
    // Split the string by commas to create an iterator
    for item in input_str.split(',') {
        // Insert each trimmed item into the HashSet, which automatically filters out duplicates
        unique_elements.insert(item.trim());
    }
    
    // Return the length of the HashSet, which is the number of unique elements
    unique_elements.len()
}